import React from 'react'
import {Route, Switch, IndexRoute} from "react-router-dom";
import Home from "../pages/home"
import Contact from "../pages/contact"
import News from "../pages/news"
import Team from "../pages/team"
import Company from "../pages/company"
import Case from "../pages/case"
import Details from "../pages/details"
import Blog from "../pages/blog"
import Job from "../pages/job"
import Jdetails from "../pages/jdetails"
const RouteList = [
    {
        path: "/",
        title:"首页",
        exact: true,
        component: Home
    },
    {
        path: "/contact",
        title:"联系我们",
        exact: true,
        component: Contact
    },
    {
        path: "/news",
        title:"新闻资讯",
        exact: true,
        component: News
    },
    {
        path: "/team",
        title:"团队精英",
        exact: true,
        component: Team
    },
    {
        path: "/company",
        title:"公司介绍",
        exact: true,
        component: Company
    },
    {
        path: "/case/:id",
        title:"项目案例",
        exact: true,
        component: Case,
    },
    {
        path: "/details",
        title:"项目详情",
        exact: true,
        component: Details
    },
    {
        path: "/blog",
        title:"咨询详情",
        exact: true,
        component: Blog
    },
    {
        path: "/job",
        title:"加入我们",
        exact: true,
        component: Job,
        // children: [
        //     {
        //         path: '/details',
        //         exact: true,
        //         // component: Case,
        //         title:"招聘详情",
        //         component: Jdetails
        //     }
        // ]
    }
    
]

export const RouteChinld = () => {
    return <Switch>
        { RouteList.map(({path, exact=true, component, children = []}, index) => {
                return <Route 
                    path={path}
                    exact={exact} 
                    component={component} 
                    key={index}
                    render={props => {
                        return <component {...props} children={children} key={index+"children"}/>
                        }
                    }
                />
            })
        }
    </Switch>
     
}